import axios from '@/libs/api.request'

/**
 * 登录
 */
export const login = ({ userName, password }) => {
  const data = {
    no: userName,
    password
  }
  return axios.request({
    url: 'web/authen/login',
    data,
    method: 'post'
  })
}

/**
 * 获取用户信息
 */
export const getUserInfo = () => {
  return axios.request({
    url: 'web/user/getUserInfo',
    method: 'get'
  })
}

export const logout = (token) => {
  return axios.request({
    url: 'logout',
    method: 'post'
  })
}

/**
  * 验证旧密码
  * @param {*} param0 用户id和用户旧密码
  */
export const checkOldPassword = (data) => {
  return axios.request({
    url: 'web/user/checkPassword',
    data,
    method: 'post'
  })
}
